/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package num8;

import Command.AbertaComandar;
import Command.FechadaComandar;
import Command.SemiComandar;
import Command.TrancadaComandar;
import Presenter.EstadoPortaPresenter;
import State.Aberto;
import State.Fechado;
import State.Semi;
import State.Trancado;
import View.Porta;
import View.viewMenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author Usuário
 */
public class Num8 {
    
    
    public static void main(String[] args) {
        final viewMenu view = new viewMenu();        
        
        view.setVisible(true);
        Aberto a = new Aberto();
        AbertaComandar ac = new AbertaComandar();
        ac.comandarView(view);
        EstadoPortaPresenter epp = new EstadoPortaPresenter(a, view);
        
        view.getBtnAberta().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                Aberto a = new Aberto();
                AbertaComandar ac = new AbertaComandar();
                EstadoPortaPresenter epp = new EstadoPortaPresenter(a, view);
                ac.comandarView(view);
            }
        });
        
        view.getBtnFechada().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                Fechado f = new Fechado();
                FechadaComandar fc = new FechadaComandar();
                EstadoPortaPresenter epp = new EstadoPortaPresenter(f, view);
                fc.comandarView(view);
            }
        });
        
        view.getBtnSemi().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                Semi s = new Semi();
                SemiComandar sc = new SemiComandar();
                EstadoPortaPresenter epp = new EstadoPortaPresenter(s, view);
                sc.comandarView(view);
            }
        });
        
        view.getBtnTrancada().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                Trancado t = new Trancado();
                TrancadaComandar tc = new TrancadaComandar();
                EstadoPortaPresenter epp = new EstadoPortaPresenter(t, view);
                tc.comandarView(view);
            }
        });
    }
    
}
